$(function () {
  // 初始化相册
  var size = $('.photo-box ul li').size();
  size = size + size%2;
  var photoBoxWidth = (385 * size)/2;
  $('#photo-frame').width(photoBoxWidth);

  //
  $('#slider-control-left').click(function () {
    var positionLeft = parseInt($('#photo-frame').css('left'));
    if (positionLeft >= 0) {
      return ;
    }
    if ((size/2) > 3) {
      $('#photo-frame').animate({
        left: positionLeft + 385 + 'px'
      }, 1000)
    }
  })
  $('#slider-control-right').click(function () {
    var positionLeft = parseInt($('#photo-frame').css('left'));
    console.log(positionLeft + (385*3), photoBoxWidth)
    if (-(positionLeft - (385*3)) >= photoBoxWidth) {
      return ;
    }
    if ((size/2) > 3) {
      $('#photo-frame').animate({
        left: positionLeft - 385 + 'px'
      }, 1000)
    }
  })
})
